Log in Register Dashboard Temp Share Shortlinks Frames API

cody - HTMLify profile

cody's Profile Picture

cody

4270 Files

634360 Views

Latest files of /cody/swapnilsparsh/30DaysOfJavaScript/149 - Snake Game Voice

main.js cody/swapnilsparsh/30DaysOfJavaScript/149 - Snake Game Voice/main.js
188 Views
0 Comments
var canvas = document.getElementById("area");

canvas.style.height = "80vh";
canvas.style.width = "80%";

var clx = canvas.getContext("2d")

var xr = Math.floor(Math.random()*(canvas.width-40)+20);
speechCommand.js cody/swapnilsparsh/30DaysOfJavaScript/149 - Snake Game Voice/speechCommand.js
180 Views
0 Comments

const URL = "https://teachablemachine.withgoogle.com/models/JHem2FpyN/";

async function createModel() {
const checkpointURL = URL + "model.json";
const metadataURL = URL + "metadata.json";

const recognizer = speechCommands.create(
style.css cody/swapnilsparsh/30DaysOfJavaScript/149 - Snake Game Voice/style.css
124 Views
0 Comments
*{
margin: 2px;
padding: 2px;
box-sizing: border-box;
}

body{
background-color: rgb(4, 230, 4);
index.html cody/swapnilsparsh/30DaysOfJavaScript/149 - Snake Game Voice/index.html
325 Views
0 Comments
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title></title>

readme.md cody/swapnilsparsh/30DaysOfJavaScript/149 - Snake Game Voice/readme.md
175 Views
0 Comments
# Snake game using voice control
This is a snake game in which a snake moves inside a box in search of food. Snake movement is controlled using voice commands - 'down', 'left', 'up', 'right'.
Whenever the snake consumes it's food, it's size increases by one unit.
If the snake touches the border of the box or it's tail, the game stops.

## **Usage**
* Download all the files and open html file in the browser of your choice.
* Allow microphone and click on 'play'.